#ifndef SENTRY_H
#define SENTRY_H

#include <qmutex.h>
#include <sstream>
#include <QDateTime>
#include <qthread.h>
#include <QtGui>  
#include <QtGui/QMainWindow>
#include <QPainter>
#include "ui_sentry.h"
#include "output.h"
#include "Command_Mod.h"
#include "Com_Mod.h"
#include "blob_detect.h"
#include <stdio.h>
#include <iostream>
#include <QImage>
#include <qslider.h>
#include <opencv2/opencv.hpp>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "beweging_detect.h"

using namespace cv;
using namespace::boost::asio;  


class Sentry : public QMainWindow
{
	Q_OBJECT

public:
	Communicator* Comm;	
	QThread* thread;
	QDateTime Time; 
	BlobDetector blob;
	OutputModule OutputUnit;
	VideoCapture Cam;
	VideoCapture CamArray[10];
	   QImage qimage;
	   QImage qImageBinary;
	   QPixmap pixmap;
	   QString FireText;
	   QString CurrentCom;
	   bool UpLink;
	   bool AutoOn;
	   bool IsConnected;
	   bool ManualOn;
	   bool UpPressed;
	   bool RightPressed;
	   bool DownPressed;
	   bool LeftPressed;
	   bool FirePressed;
	   bool FoundCams;
	   int Xas;
	   int Yas;

	Sentry(QWidget *parent = 0, Qt::WFlags flags = 0);
	~Sentry();
	 
public slots:

	void GetImage();
	void TrackingDynamic();
	void QuitMode();
	void Disconnect();
	void Connect();
	void Manual();
	void Up();
	void Right();
	void Down();
	void Left();
	void Fire();
	void SetButton();
	void SaveLog();
	void ClearLog();
	void LoadLog();
	void UpdateCom();

	//set HSV values
	void Calibrate();
	void SetHueLow(int i);
	void SetSatLow(int i);
	void SetValLow(int i);
	void SetHueHigh(int i);
	void SetSatHigh(int i);
	void SetValHigh(int i);
	//reset to default
	void ResetLowVals();
	void ResetHighVals();
	//lock values
	void LockLowerVals();
	void LockHigherVals();

	void Beweging_detector_caller();

private:
	Ui::SentryClass ui;

};


#endif // SENTRY_H
